<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: stats_products_viewed.php 117 2013-09-21 12:09:03Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 117 $
* 	zuletzt geaendert von:	$Author: peter $
* 	Datum:					$Date: 2013-09-21 12:09:03 +0000 (Sat, 21 Sep 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

require('includes/application_top.php');
require(DIR_WS_INCLUDES.'metatag.php');
?>
</head>
<body>
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<div id="wrapper">
<table class="outerTable" cellspacing="0" cellpadding="0">
  <tr>
    <td class="columnLeft2" width="<?php echo BOX_WIDTH; ?>" valign="top">
		<table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
			<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
    	</table>
	</td>
    <td class="boxCenter" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
        <td>
			<table border="0" width="100%" cellspacing="0" cellpadding="0">
  				<tr>
				    <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
				</tr>
			</table>
		</td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0" class="dataTable">
              <tr class="dataTableHeadingRow">
                <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_NUMBER; ?></td>
                <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS; ?></td>
                <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_VIEWED; ?>&nbsp;</td>
              </tr>
			<?php
			  if ($_GET['page'] > 1) $rows = $_GET['page'] * '20' - '20';
			  	$sql = "SELECT p.products_id, pd.products_name, pd.products_viewed, l.name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_LANGUAGES . " l WHERE p.products_id = pd.products_id and l.languages_id = pd.language_id ORDER BY pd.products_viewed DESC";
				$query = page_break_create($_POST['per_site'], $_GET['page'], $sql, 'stats_products_viewed.php');
				$products = $query['query'];
				
			  while (!$products->EOF) {
			    $rows++;

			    if (strlen($rows) < 2) {
			      $rows = '0' . $rows;
			    }
				if ($rows % 2 == 0)
		    		$f = 'dataTableRow';
		    	else
		    		$f = '';
				echo '<tr class="'. $f.'" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'pointer\'" onmouseout="this.className=\''. $f.'\'">'."\n";
			?>
                <td><?php echo $rows; ?>.</td>
                <td><?php echo  $products->fields['products_name'] . '(' . $products->fields['name'] . ')'; ?></td>
                <td align="center"><?php echo $products->fields['products_viewed']; ?>&nbsp;</td>
              </tr>
			<?php
			$products->MoveNext();
			  }
			?>
            </table></td>
          </tr>
          <tr>
            <td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr class="page_break">
					<td class="smallText" valign="top" width="33.3%"><?php echo 'Angezeigt werden '.$query['from'].' bis '.$query['to'].' (von insgesamt '.$query['total'].' Artikel)'; ?></td>
					<td class="smallText" align="center" width="33.3%"></td>
					<td class="smallText" align="right" width="33.3%">
						Artikel pro Seite: <?php echo $query['page_break']->perSiteDropdown($_GET['page']); ?>
					</td>
				</tr>
				<tr><td align="center" colspan="3"><?php echo '<br />'.$query['links']; ?></td></tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</div>
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>